﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StutorMadeCsharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Interval = 2000;
            timer1.Enabled = true;
        }

        string olddata;
        bool first = true;
        private void timer1_Tick(object sender, EventArgs e)
        {
            System.Net.WebClient wc = new System.Net.WebClient();
            byte[] raw = wc.DownloadData("http://devpump.dyndns.org/stutor/testcreate.php");
            string newdata = System.Text.Encoding.UTF8.GetString(raw);
            
            if (newdata != olddata)
            {
                if (first == true)
                {
                    textBox1.Text += newdata;
                    first = false;
                }
                textBox1.Text += "\n" + newdata;
                olddata = newdata;
            }

        }
    }
}
